package com.hc.model.code04.test3;

import java.util.Map;
import java.util.Set;

/**
 * @version v1.0
 * @ClassName: OrderCommand
 * @Description: 订单命令类（具体具体的命令类）
 * @Author: HC
 */
public class OrderCommand implements Command {

    // 定义接收者对象
    private SeniorChef receiver;
    private Order order;

    public OrderCommand(SeniorChef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }

    @Override
    public void execute() {
        System.out.println(order.getDiningTable() + "桌订单开始准备");
        Map<String, Integer> foodDir = order.getFoodDir();
        Set<String> keys = foodDir.keySet();
        for (String name : keys) {
            // 交给厨师完成订单
            receiver.makeFood(name, foodDir.get(name));
        }
        // 订单完成
        System.out.println(order.getDiningTable() + "桌订单已准备完毕！！！");


    }
}
